#include <bits/stdc++.h>
using namespace std;
int a, b;
int a1[10001], b1[1001];
int a1c = 0, b1c = 0, c1c = 0;
int c1[10001];
int sum[1001] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
int main() {
    cin >> a >> b;
    int x = a;
    while(x > 0) {
        a1[++a1c] = x % 10;
        x /= 10;
    }
    x = b;
    while(x > 0) {
        b1[++b1c] = x % 10;
        x /= 10;
    }
    x = a + b;
    while(x > 0) {
        c1[++c1c] = x % 10;
        x /= 10;
    }
    int ans = 0;
    for(int i = 1; i <= a1c; i ++) {
        ans += sum[a1[i]];
    }
    for(int i = 1; i <= b1c; i ++) {
        ans += sum[b1[i]];
    }
    for(int i = 1; i <= c1c; i ++) {
        ans += sum[c1[i]];
    }
    ans += 4;
    cout << ans << endl;
}
